Button Flash() in tkinter


Button flash several times between active and normal colors. When button is disabled  it Ignored.

******Your code Below*****
from tkinter import*

root = Tk()
root.title("Button Flush")
root.geometry("800x350+450+86")

lbl =Label(root,font=("times", 20, "bold"),text ='Press f to make button flash')
lbl.pack(pady=50)

btn =Button(root,text = 'Useless Button',font=("times", 20, "bold"),bg="red")
btn.pack()

def flash(event):
btn.config(bg = 'yellow')
root.after(1000, lambda: btn.config(bg = 'red'))

root.bind("<KeyPress-f>", flash)

root.mainloop()

********End Code**********


Write Down Code Your Code Editor. To show Your Output. If Use Pycharm Press Shift+F10 and Show Your Output.






Enjoy..............


If You Want To Learn More Plz Visit www.newpost24.com

If You Find Specific link plz Follow This Page.

Post a Comment

Previous Post Next Post